#ifndef __HIEWLDRV__
#define __HIEWLDRV__

#include <winioctl.h>
#include <basetype.h>
#include <ceddk.h>
#include "hisi6810_intr.h"

//Enchw defination
#define CSP_BASE_REG_PA_MPEG4_ENCODER   0x20005000  //0x91005000 //  -0x900AFFFF
#define ENCHW_REGMAP_PADDR          CSP_BASE_REG_PA_MPEG4_ENCODER

#define SYSCTRL_BASE_ADDRESS	0x20040000
#define ENC_CLOCK_ENABLE        (1<<5)
#define SCPEREN								0x024
#define SCPERDIS							0x028

//IOCTL DEFINE
#define IOCTL_EWL_GETREGVA          CTL_CODE(FILE_DEVICE_VIDEO, 0x111, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_EWL_GETRESMEM         CTL_CODE(FILE_DEVICE_VIDEO, 0x112, METHOD_BUFFERED, FILE_READ_ACCESS)
//IOCTL END

#define EWL_IST_PRIORITY            203

#define EWL_OK                      0
#define EWL_ERROR                  -1


#define EWLMSG(cond,printf_exp)	 \
   (NKDbgPrintfW printf_exp)

#define EWL_INTR_EVENT_NAME  (TEXT("EwlIntrEvent"))

#define MEM_MAP_BASE_SIZE     0x1000
#define IRQ_MPEG4_ENCODE      (FPGA_ENCODER_INTR) 
#define ENC_INTR_IRQ          IRQ_MPEG4_ENCODE    // IRQ number defined in CSP
#define ENC_INTR_TIMEOUT      2000                // timeout for encoder ready interrupt  
#define ENC_ENCHW_TIMEOUT     10000               // timeout for encoder hw access

#define ENC_INSTANCE_MUTEX    _T("ENC_INSTANCE_MUTEX")

#define ENC_DEBUG             1            // define to non-zero to enable debug messages
#define ENC_DEBUG_EXTRA       0            // enables verbose debug messages 



#ifdef EWL_DEBUG

#ifdef  RETAILMSG
#undef  RETAILMSG
#endif

#define RETAILMSG(exp, p) DEBUGMSG(exp, p)
#endif



typedef struct Ewl_Phy2Virt_Addr
{
	PBYTE pPhyAddr;
	PBYTE pVirtAddrfrmAllocPhysMem;
	PBYTE pVirtAddrfrmMmMapIoSpace;
	DWORD dwAllocSize;
}EWL_PHY_VIRT_ADDR;




#define SAFEDELETE( pointer ) \
    if ( NULL != pointer )    \
    {                         \
        delete pointer;       \
        pointer = NULL;       \
    }	




EXTERN_C DWORD EDR_Init(VOID * pContext);
EXTERN_C BOOL EDR_Deinit( DWORD Context);
EXTERN_C BOOL EDR_IOControl( DWORD context, DWORD ioctl, PUCHAR inBuf, DWORD inBufLen,
                    PUCHAR outBuf, DWORD outBufLen, PDWORD bytesTransferred );





#endif /*__HIEWLDRV__*/ 
